﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using FXnaInfrastructure;
using FXnaGis;

namespace ASCore
{
    [Serializable]
    public abstract class BaseSource:FComposeShape
    {

        public BaseSource(string id)
            : base(id)
        {
 
        }


        //排放速率？
        Dictionary<string, double> _dicRates = new Dictionary<string, double>();


        public void ResetPollutions(FEntityCollection pollutions)
        {


            //写的可能有点罗嗦



            foreach (FEntity item in pollutions.Entities)
            {

                //先加上没有的项目

                if (this._dicRates.ContainsKey(item.Id))
                {


                }
                else
                {
                    this._dicRates.Add(item.Id,0);
                }
                
            }


            //去掉不存在的项目

            List<string> temp = new List<string>();

            foreach (string id in this._dicRates.Keys)
            {
                if (pollutions.IsExist(id))
                {



                }
                else
                {
                    temp.Add(id);
                }
                
            }


            foreach (string id in temp)
            {
                this._dicRates.Remove(id);
                
            }




        }


        bool _useVaryRate=false;

        /// <summary>
        /// 是否使用可变排放速率
        /// </summary>
        public bool UseVaryRate
        {
            get { return _useVaryRate; }
            set { _useVaryRate = value; }
        }

        public override object Clone()
        {
            BaseSource bs =(BaseSource) base.Clone();

            bs._dicRates = new Dictionary<string, double>();

            foreach (KeyValuePair<string,double> kv in this._dicRates)
            {
                
                bs._dicRates.Add (kv.Key,kv.Value);

            }


            return bs;
        }
        
        


    }
}
